package com.nbsaas.boot.product.data.entity;

import com.nbsaas.boot.code.annotation.*;
import com.nbsaas.boot.jpa.data.entity.AbstractEntity;
import jakarta.persistence.*;
import lombok.Data;
import org.hibernate.annotations.Comment;

/**
 * 商品图片实体
 * 用于管理商品的展示图片
 */
@Comment("商品图片")
@Data
@FormAnnotation(title = "商品图片管理", model = "商品图片")
@Entity
@Table(name = "nb_product_image")
public class ProductImage extends AbstractEntity {

    @Comment("所属商品")
    @FieldName
    @FieldConvert
    @FormField(title = "商品", type = InputType.select, option = "product")
    @ManyToOne(fetch = FetchType.LAZY)
    private Product product;

    @Comment("图片URL地址")
    @FormField(title = "图片路径", grid = true, type = InputType.image)
    @Column(length = 255)
    private String path;

    @Comment("显示顺序")
    @FormField(title = "排序号", grid = true, type = InputType.el_input_number)
    private Integer sortNum;

    @Comment("图片说明")
    @FormField(title = "备注", type = InputType.textarea)
    @Column(length = 500)
    private String note;
} 